package com.ruoyi.web.controller.api;


import com.ruoyi.cat.domain.DTO.HomeDTO;
import com.ruoyi.cat.domain.VO.LoginVO;
import com.ruoyi.cat.service.IAdGiftService;
import com.ruoyi.cat.service.ICatActivityTableService;
import com.ruoyi.cat.service.ICatArticletaskTableService;
import com.ruoyi.common.core.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@Api(tags = "api-数据分析")
@RestController
@RequestMapping("/api/home")
@Slf4j
public class HomeController {

    @Autowired
    private ICatArticletaskTableService catArticletaskTableService;

    @Autowired
    private ICatActivityTableService iCatActivityTableService;

    @Autowired
    private IAdGiftService iAdGiftService;

    @ApiOperation("新首页接口")
    @GetMapping("/getHome")
    public AjaxResult getHome(){
        HomeDTO homeDTO = new HomeDTO();
        homeDTO.setArticleList(catArticletaskTableService.getArticletaskTaskHome());
        homeDTO.setActivityList(iCatActivityTableService.getActivityTaskHome());
        homeDTO.setAdGiftList(iAdGiftService.getAdGiftList(5));
        return AjaxResult.success(homeDTO);
    }


}
